-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Fix a spurious error that was emitted for invalid DW_AT_decl_file. #152608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-debuginfo Author: Greg Clayton (clayborg) ChangesThe GSYM code was trying to warn if there are no line table entries for a function and if the DW_AT_decl_file attribute had a file index that was invalid. The code was always emitting a error even if a DW_TAG_subprogram DIE had no DW_AT_decl_file. We should only emit an error if there is a DW_AT_decl_file attribute and it's file index isn't valid. Patch is 43.16 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/152608.diff 2 Files Affected:
diff --git a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
index 7a0256f10ea60..9d7b767b65acb 100644
--- a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
+++ b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
@@ -82,7 +82,6 @@ struct llvm::gsym::CUInfo {
}
};
-
static DWARFDie GetParentDeclContextDIE(DWARFDie &Die) {
if (DWARFDie SpecDie =
Die.getAttributeValueAsReferencedDie(dwarf::DW_AT_specification)) {
@@ -170,7 +169,7 @@ getQualifiedNameIndex(DWARFDie &Die, uint64_t Language, GsymCreator &Gsym) {
// templates
if (ParentName.front() == '<' && ParentName.back() == '>')
Name = "{" + ParentName.substr(1, ParentName.size() - 2).str() + "}" +
- "::" + Name;
+ "::" + Name;
else
Name = ParentName.str() + "::" + Name;
}
@@ -338,9 +337,13 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
if (FilePath.empty()) {
// If we had a DW_AT_decl_file, but got no file then we need to emit a
// warning.
+ const uint64_t DwarfFileIdx = dwarf::toUnsigned(
+ Die.findRecursively(dwarf::DW_AT_decl_file), UINT32_MAX);
+ // Check if there is no DW_AT_decl_line attribute, and don't report an
+ // error if it isn't there.
+ if (DwarfFileIdx == UINT32_MAX)
+ return;
Out.Report("Invalid file index in DW_AT_decl_file", [&](raw_ostream &OS) {
- const uint64_t DwarfFileIdx = dwarf::toUnsigned(
- Die.findRecursively(dwarf::DW_AT_decl_file), UINT32_MAX);
OS << "error: function DIE at " << HEX32(Die.getOffset())
<< " has an invalid file index " << DwarfFileIdx
<< " in its DW_AT_decl_file attribute, unable to create a single "
@@ -432,7 +435,7 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
// Skip multiple line entries for the same file and line.
auto LastLE = FI.OptLineTable->last();
if (LastLE && LastLE->File == FileIdx && LastLE->Line == Row.Line)
- continue;
+ continue;
// Only push a row if it isn't an end sequence. End sequence markers are
// included for the last address in a function or the last contiguous
// address in a sequence.
@@ -718,8 +721,8 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
for (uint32_t I = 0; I < NumAddrs; ++I) {
auto FuncAddr = Gsym->getAddress(I);
if (!FuncAddr)
- return createStringError(std::errc::invalid_argument,
- "failed to extract address[%i]", I);
+ return createStringError(std::errc::invalid_argument,
+ "failed to extract address[%i]", I);
auto FI = Gsym->getFunctionInfo(*FuncAddr);
if (!FI)
@@ -734,8 +737,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
if (!LR)
return LR.takeError();
- auto DwarfInlineInfos =
- DICtx.getInliningInfoForAddress(SectAddr, DLIS);
+ auto DwarfInlineInfos = DICtx.getInliningInfoForAddress(SectAddr, DLIS);
uint32_t NumDwarfInlineInfos = DwarfInlineInfos.getNumberOfFrames();
if (NumDwarfInlineInfos == 0) {
DwarfInlineInfos.addFrame(
@@ -773,8 +775,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
continue;
}
- for (size_t Idx = 0, count = LR->Locations.size(); Idx < count;
- ++Idx) {
+ for (size_t Idx = 0, count = LR->Locations.size(); Idx < count; ++Idx) {
const auto &gii = LR->Locations[Idx];
if (Idx < NumDwarfInlineInfos) {
const auto &dii = DwarfInlineInfos.getFrame(Idx);
diff --git a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
index 33f53de2e77bc..8935714e00ff5 100644
--- a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -24,8 +24,8 @@
#include "llvm/Support/DataExtractor.h"
#include "llvm/Testing/Support/Error.h"
-#include "gtest/gtest.h"
#include "gmock/gmock.h"
+#include "gtest/gtest.h"
#include <string>
using namespace llvm;
@@ -99,7 +99,7 @@ TEST(GSYMTest, TestFunctionInfo) {
const uint32_t FileIdx = 1;
const uint32_t Line = 12;
FI.OptLineTable = LineTable();
- FI.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
+ FI.OptLineTable->push(LineEntry(StartAddr, FileIdx, Line));
EXPECT_TRUE(FI.hasRichInfo());
FI.clear();
EXPECT_FALSE(FI.isValid());
@@ -135,7 +135,7 @@ TEST(GSYMTest, TestFunctionInfo) {
FunctionInfo FISymtab(StartAddr, Size, NameOffset);
FunctionInfo FIWithLines(StartAddr, Size, NameOffset);
FIWithLines.OptLineTable = LineTable();
- FIWithLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
+ FIWithLines.OptLineTable->push(LineEntry(StartAddr, FileIdx, Line));
// Test that a FunctionInfo with just a name and size is less than one
// that has name, size and any number of line table entries
EXPECT_LT(FISymtab, FIWithLines);
@@ -166,7 +166,7 @@ TEST(GSYMTest, TestFunctionInfo) {
// Test if we have an entry with lines and one with more lines for the same
// range, the ones with more lines is greater than the one with less.
FunctionInfo FIWithMoreLines = FIWithLines;
- FIWithMoreLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line+5));
+ FIWithMoreLines.OptLineTable->push(LineEntry(StartAddr, FileIdx, Line + 5));
EXPECT_LT(FIWithLines, FIWithMoreLines);
// Test that if we have the same number of lines we compare the line entries
@@ -198,24 +198,27 @@ TEST(GSYMTest, TestFunctionInfoDecodeErrors) {
FileWriter FW(OutStrm, ByteOrder);
const uint64_t BaseAddr = 0x100;
TestFunctionInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000000: missing FunctionInfo Size");
+ "0x00000000: missing FunctionInfo Size");
FW.writeU32(0x100); // Function size.
TestFunctionInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000004: missing FunctionInfo Name");
+ "0x00000004: missing FunctionInfo Name");
// Write out an invalid Name string table offset of zero.
FW.writeU32(0);
- TestFunctionInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
+ TestFunctionInfoDecodeError(
+ ByteOrder, OutStrm.str(), BaseAddr,
"0x00000004: invalid FunctionInfo Name value 0x00000000");
// Modify the Name to be 0x00000001, which is a valid value.
FW.fixup32(0x00000001, 4);
- TestFunctionInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
+ TestFunctionInfoDecodeError(
+ ByteOrder, OutStrm.str(), BaseAddr,
"0x00000008: missing FunctionInfo InfoType value");
auto FixupOffset = FW.tell();
FW.writeU32(1); // InfoType::LineTableInfo.
- TestFunctionInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
+ TestFunctionInfoDecodeError(
+ ByteOrder, OutStrm.str(), BaseAddr,
"0x0000000c: missing FunctionInfo InfoType length");
FW.fixup32(7, FixupOffset); // Write an invalid InfoType enumeration value
- FW.writeU32(0); // LineTableInfo InfoType data length.
+ FW.writeU32(0); // LineTableInfo InfoType data length.
TestFunctionInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
"0x00000008: unsupported InfoType 7");
}
@@ -278,25 +281,24 @@ static void TestFunctionInfoEncodeDecode(llvm::endianness ByteOrder,
}
static void AddLines(uint64_t FuncAddr, uint32_t FileIdx, FunctionInfo &FI) {
- FI.OptLineTable = LineTable();
- LineEntry Line0(FuncAddr + 0x000, FileIdx, 10);
- LineEntry Line1(FuncAddr + 0x010, FileIdx, 11);
- LineEntry Line2(FuncAddr + 0x100, FileIdx, 1000);
- FI.OptLineTable->push(Line0);
- FI.OptLineTable->push(Line1);
- FI.OptLineTable->push(Line2);
+ FI.OptLineTable = LineTable();
+ LineEntry Line0(FuncAddr + 0x000, FileIdx, 10);
+ LineEntry Line1(FuncAddr + 0x010, FileIdx, 11);
+ LineEntry Line2(FuncAddr + 0x100, FileIdx, 1000);
+ FI.OptLineTable->push(Line0);
+ FI.OptLineTable->push(Line1);
+ FI.OptLineTable->push(Line2);
}
-
static void AddInline(uint64_t FuncAddr, uint64_t FuncSize, FunctionInfo &FI) {
- FI.Inline = InlineInfo();
- FI.Inline->Ranges.insert(AddressRange(FuncAddr, FuncAddr + FuncSize));
- InlineInfo Inline1;
- Inline1.Ranges.insert(AddressRange(FuncAddr + 0x10, FuncAddr + 0x30));
- Inline1.Name = 1;
- Inline1.CallFile = 1;
- Inline1.CallLine = 11;
- FI.Inline->Children.push_back(Inline1);
+ FI.Inline = InlineInfo();
+ FI.Inline->Ranges.insert(AddressRange(FuncAddr, FuncAddr + FuncSize));
+ InlineInfo Inline1;
+ Inline1.Ranges.insert(AddressRange(FuncAddr + 0x10, FuncAddr + 0x30));
+ Inline1.Name = 1;
+ Inline1.CallFile = 1;
+ Inline1.CallLine = 11;
+ FI.Inline->Children.push_back(Inline1);
}
TEST(GSYMTest, TestFunctionInfoEncoding) {
@@ -514,21 +516,25 @@ TEST(GSYMTest, TestInlineInfoDecodeErrors) {
raw_svector_ostream OutStrm(Str);
FileWriter FW(OutStrm, ByteOrder);
const uint64_t BaseAddr = 0x100;
- TestInlineInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
+ TestInlineInfoDecodeError(
+ ByteOrder, OutStrm.str(), BaseAddr,
"0x00000000: missing InlineInfo address ranges data");
AddressRanges Ranges;
- Ranges.insert({BaseAddr, BaseAddr+0x100});
+ Ranges.insert({BaseAddr, BaseAddr + 0x100});
encodeRanges(Ranges, FW, BaseAddr);
- TestInlineInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
+ TestInlineInfoDecodeError(
+ ByteOrder, OutStrm.str(), BaseAddr,
"0x00000004: missing InlineInfo uint8_t indicating children");
FW.writeU8(0);
TestInlineInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000005: missing InlineInfo uint32_t for name");
+ "0x00000005: missing InlineInfo uint32_t for name");
FW.writeU32(0);
- TestInlineInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
+ TestInlineInfoDecodeError(
+ ByteOrder, OutStrm.str(), BaseAddr,
"0x00000009: missing ULEB128 for InlineInfo call file");
FW.writeU8(0);
- TestInlineInfoDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
+ TestInlineInfoDecodeError(
+ ByteOrder, OutStrm.str(), BaseAddr,
"0x0000000a: missing ULEB128 for InlineInfo call line");
}
@@ -708,20 +714,20 @@ TEST(GSYMTest, TestLineTable) {
const uint64_t StartAddr = 0x1000;
const uint32_t FileIdx = 1;
LineTable LT;
- LineEntry Line0(StartAddr+0x000, FileIdx, 10);
- LineEntry Line1(StartAddr+0x010, FileIdx, 11);
- LineEntry Line2(StartAddr+0x100, FileIdx, 1000);
+ LineEntry Line0(StartAddr + 0x000, FileIdx, 10);
+ LineEntry Line1(StartAddr + 0x010, FileIdx, 11);
+ LineEntry Line2(StartAddr + 0x100, FileIdx, 1000);
ASSERT_TRUE(LT.empty());
ASSERT_EQ(LT.size(), (size_t)0);
LT.push(Line0);
ASSERT_EQ(LT.size(), (size_t)1);
LT.push(Line1);
LT.push(Line2);
- LT.push(LineEntry(StartAddr+0x120, FileIdx, 900));
- LT.push(LineEntry(StartAddr+0x120, FileIdx, 2000));
- LT.push(LineEntry(StartAddr+0x121, FileIdx, 2001));
- LT.push(LineEntry(StartAddr+0x122, FileIdx, 2002));
- LT.push(LineEntry(StartAddr+0x123, FileIdx, 2003));
+ LT.push(LineEntry(StartAddr + 0x120, FileIdx, 900));
+ LT.push(LineEntry(StartAddr + 0x120, FileIdx, 2000));
+ LT.push(LineEntry(StartAddr + 0x121, FileIdx, 2001));
+ LT.push(LineEntry(StartAddr + 0x122, FileIdx, 2002));
+ LT.push(LineEntry(StartAddr + 0x123, FileIdx, 2003));
ASSERT_FALSE(LT.empty());
ASSERT_EQ(LT.size(), (size_t)8);
// Test operator[].
@@ -783,30 +789,30 @@ TEST(GSYMTest, TestLineTableDecodeErrors) {
FileWriter FW(OutStrm, ByteOrder);
const uint64_t BaseAddr = 0x100;
TestLineTableDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000000: missing LineTable MinDelta");
+ "0x00000000: missing LineTable MinDelta");
FW.writeU8(1); // MinDelta (ULEB)
TestLineTableDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000001: missing LineTable MaxDelta");
+ "0x00000001: missing LineTable MaxDelta");
FW.writeU8(10); // MaxDelta (ULEB)
TestLineTableDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000002: missing LineTable FirstLine");
+ "0x00000002: missing LineTable FirstLine");
FW.writeU8(20); // FirstLine (ULEB)
TestLineTableDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000003: EOF found before EndSequence");
+ "0x00000003: EOF found before EndSequence");
// Test a SetFile with the argument missing from the stream
FW.writeU8(1); // SetFile opcode (uint8_t)
TestLineTableDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000004: EOF found before SetFile value");
+ "0x00000004: EOF found before SetFile value");
FW.writeU8(5); // SetFile value as index (ULEB)
// Test a AdvancePC with the argument missing from the stream
FW.writeU8(2); // AdvancePC opcode (uint8_t)
TestLineTableDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000006: EOF found before AdvancePC value");
+ "0x00000006: EOF found before AdvancePC value");
FW.writeU8(20); // AdvancePC value as offset (ULEB)
// Test a AdvancePC with the argument missing from the stream
FW.writeU8(3); // AdvanceLine opcode (uint8_t)
TestLineTableDecodeError(ByteOrder, OutStrm.str(), BaseAddr,
- "0x00000008: EOF found before AdvanceLine value");
+ "0x00000008: EOF found before AdvanceLine value");
FW.writeU8(20); // AdvanceLine value as offset (LLEB)
}
@@ -823,16 +829,17 @@ TEST(GSYMTest, TestLineTableEncodeErrors) {
// Try to encode a line table where a line entry has an address that is less
// than BaseAddr and verify we get an appropriate error.
- LineEntry Line0(BaseAddr+0x000, FileIdx, 10);
- LineEntry Line1(BaseAddr+0x010, FileIdx, 11);
+ LineEntry Line0(BaseAddr + 0x000, FileIdx, 10);
+ LineEntry Line1(BaseAddr + 0x010, FileIdx, 11);
LT.push(Line0);
LT.push(Line1);
checkError("LineEntry has address 0x1000 which is less than the function "
- "start address 0x1010", LT.encode(FW, BaseAddr+0x10));
+ "start address 0x1010",
+ LT.encode(FW, BaseAddr + 0x10));
LT.clear();
- // Try to encode a line table where a line entries has an address that is less
- // than BaseAddr and verify we get an appropriate error.
+ // Try to encode a line table where a line entries has an address that is
+ // less than BaseAddr and verify we get an appropriate error.
LT.push(Line1);
LT.push(Line0);
checkError("LineEntry in LineTable not in ascending order",
@@ -870,9 +877,9 @@ static void InitHeader(Header &H) {
H.UUIDSize = 16;
H.BaseAddress = 0x1000;
H.NumAddresses = 1;
- H.StrtabOffset= 0x2000;
+ H.StrtabOffset = 0x2000;
H.StrtabSize = 0x1000;
- for (size_t i=0; i<GSYM_MAX_UUID_SIZE; ++i) {
+ for (size_t i = 0; i < GSYM_MAX_UUID_SIZE; ++i) {
if (i < H.UUIDSize)
H.UUID[i] = i;
else
@@ -952,10 +959,10 @@ static void TestGsymCreatorEncodeError(llvm::endianness ByteOrder,
}
TEST(GSYMTest, TestGsymCreatorEncodeErrors) {
- const uint8_t ValidUUID[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16};
- const uint8_t InvalidUUID[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21};
+ const uint8_t ValidUUID[] = {1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16};
+ const uint8_t InvalidUUID[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
// Verify we get an error when trying to encode an GsymCreator with no
// function infos. We shouldn't be saving a GSYM file in this case since
// there is nothing inside of it.
@@ -988,7 +995,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) {
// table.
GC.forEachFunctionInfo([](FunctionInfo &FI) -> bool {
FI.OptLineTable = LineTable(); // Invalid line table.
- return false; // Stop iterating
+ return false; // Stop iterating
});
TestGsymCreatorEncodeError(llvm::endianness::little, GC,
"attempted to encode invalid LineTable object");
@@ -997,7 +1004,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) {
GC.forEachFunctionInfo([](FunctionInfo &FI) -> bool {
FI.OptLineTable = std::nullopt;
FI.Inline = InlineInfo(); // Invalid InlineInfo.
- return false; // Stop iterating
+ return false; // Stop iterating
});
TestGsymCreatorEncodeError(llvm::endianness::little, GC,
"attempted to encode invalid InlineInfo object");
@@ -1043,8 +1050,8 @@ TEST(GSYMTest, TestGsymCreator1ByteAddrOffsets) {
constexpr uint8_t AddrOffSize = 1;
const uint32_t Func1Name = GC.insertString("foo");
const uint32_t Func2Name = GC.insertString("bar");
- GC.addFunctionInfo(FunctionInfo(BaseAddr+0x00, 0x10, Func1Name));
- GC.addFunctionInfo(FunctionInfo(BaseAddr+0x20, 0x10, Func2Name));
+ GC.addFunctionInfo(FunctionInfo(BaseAddr + 0x00, 0x10, Func1Name));
+ GC.addFunctionInfo(FunctionInfo(BaseAddr + 0x20, 0x10, Func2Name));
OutputAggregator Null(nullptr);
Error Err = GC.finalize(Null);
ASSERT_FALSE(Err);
@@ -1066,8 +1073,8 @@ TEST(GSYMTest, TestGsymCreator2ByteAddrOffsets) {
constexpr uint8_t AddrOffSize = 2;
const uint32_t Func1Name = GC.insertString("foo");
const uint32_t Func2Name = GC.insertString("bar");
- GC.addFunctionInfo(FunctionInfo(BaseAddr+0x000, 0x100, Func1Name));
- GC.addFunctionInfo(FunctionInfo(BaseAddr+0x200, 0x100, Func2Name));
+ GC.addFunctionInfo(FunctionInfo(BaseAddr + 0x000, 0x100, Func1Name));
+ GC.addFunctionInfo(FunctionInfo(BaseAddr + 0x200, 0x100, Func2Name));
OutputAggregator Null(nullptr);
Error Err = GC.finalize(Null);
ASSERT_FALSE(Err);
@@ -1089,8 +1096,8 @@ TEST(GSYMTest, TestGsymCreator4ByteAddrOffsets) {
constexpr uint8_t AddrOffSize = 4;
const uint32_t Func1Name = GC.insertString("foo");
const uint32_t Func2Name = GC.insertString("bar");
- GC.addFunctionInfo(FunctionInfo(BaseAddr+0x000, 0x100, Func1Name));
- GC.addFunctionInfo(FunctionInfo(BaseAddr+0x20000, 0x100, Func2Name));
+ GC.addFunctionInfo(FunctionInfo(BaseAddr + 0x000, 0x100, Func1Name));
+ GC.addFunctionInfo(FunctionInfo(BaseAddr + 0x20000, 0x100, Func2Name));
OutputAggregator Null(nullptr);
Error Err = GC.finalize(Null);
ASSERT_FALSE(Err);
@@ -1112,8 +1119,8 @@ TEST(GSYMTest, TestGsymCreator8ByteAddrOffsets) {
constexpr uint8_t AddrOffSize = 8;
const uint32_t Func1Name = GC.insertString("foo");
const uint32_t Func2Name = GC.insertString("bar");
- GC.addFunctionInfo(FunctionInfo(BaseAddr+0x000, 0x100, Func1Name));
- GC.addFunctionInfo(FunctionInfo(BaseAddr+0x100000000, 0x100, Func2Name));
+ GC.addFunctionInfo(FunctionInfo(BaseAddr + 0x000, 0x100, Func1Name));
+ GC.addFunctionInfo(FunctionInfo(BaseAddr + 0x100000000, 0x100, Func2Name));
OutputAggregator Null(nullptr);
Error Err = GC.finalize(Null);
ASSERT_FALSE(Err);
@@ -1147,7 +1154,7 @@ TEST(GSYMTest, TestGsymReader) {
GC.setUUID(UUID);
constexpr uint64_t BaseAddr = 0x1000;
constexpr uint64_t Func1Addr = BaseAddr;
- constexpr uint64_t Func2Addr = BaseAddr+0x20;
+ constexpr uint64_t Func2Addr = BaseAddr + 0x20;
constexpr uint64_t FuncSize = 0x10;
const uint32_t Func1Name = GC.insertString("foo");
const uint32_t Func2Name = GC.insertString("bar");
@@ -1164,20 +1171,20 @@ TEST(GSYMTest, TestGsymReader) {
ASSERT_FALSE((bool)Err);
if (auto ExpectedGR = GsymReader::copyBuffer(OutStrm.str())) {
const GsymReader &GR = ExpectedGR.get();
- VerifyFunctionInfoError(GR, Func1Addr-1, "address 0xfff is not in GSYM");
+ VerifyFunctionInfoError(GR, Func1Addr - 1, "address 0xfff is not in GSYM");
FunctionInfo Func1(Func1Addr, FuncSize, Func1Name);
VerifyFunctionInfo(GR, Func1Addr, Func1);
- VerifyFunctionInfo(GR, Func1Addr+1, Func1);
- VerifyFunctionInfo(GR, Func1Addr+FuncSize-1, Func1);
- VerifyFunctionInfoError(GR, Func1Addr+FuncSize,
+ VerifyFunctionInfo(GR, Func1Addr + 1, Func1);
+ VerifyFunctionInfo(GR, Func1Addr + FuncSize - 1, Func1);
+ VerifyFunctionInfoError(GR, Func1Addr + FuncSize,
"a...
[truncated]
|
The GSYM code was trying to warn if there are no line table entries for a function and if the DW_AT_decl_file attribute had a file index that was invalid. The code was always emitting a error even if a DW_TAG_subprogram DIE had no DW_AT_decl_file. We should only emit an error if there is a DW_AT_decl_file attribute and it's file index isn't valid.
704841f
to
17aa9a0
Compare
The GSYM code was trying to warn if there are no line table entries for a function and if the DW_AT_decl_file attribute had a file index that was invalid. The code was always emitting a error even if a DW_TAG_subprogram DIE had no DW_AT_decl_file. We should only emit an error if there is a DW_AT_decl_file attribute and it's file index isn't valid.